﻿/* ***********************************************
 * Author		:  kingthy
 * Email		:  kingthy@gmail.com
 * Description	:  Tweet
 *
 * ***********************************************/

using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace OpenTwitter.SDK.Sina.Objects
{
    /// <summary>
    /// 微博数据
    /// </summary>
    public class Tweet
        : TweetSummary
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="xml"></param>
        internal Tweet(XmlNode xml)
            : base(xml)
        { }

        /// <summary>
        /// 发表微博的用户
        /// </summary>
        public UserProfile User { get; private set; }

        /// <summary>
        /// 源微博
        /// </summary>
        public Tweet TweetSource { get; private set; }

        /// <summary>
        /// 解析XML文档数据
        /// </summary>
        protected override void Parse()
        {
            base.Parse();
            this.User = Util.GetXmlNodeValue<UserProfile>(this.Xml.SelectSingleNode("user"));
            this.TweetSource = Util.GetXmlNodeValue<Tweet>(this.Xml.SelectSingleNode("retweeted_status"));
        }
    }
}
